<!DOCTYPE html>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!--360浏览器优先以webkit内核解析-->
    <title>kettle watchdog 管理系统</title>
    <link rel="shortcut icon" href="favicon.jpg">
    <link href="../static/css/bootstrap.min.css" th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
    <link href="../static/css/font-awesome.min.css" th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
    <link href="../static/css/style.min.css" th:href="@{/css/style.min.css}" rel="stylesheet"/>
</head>

<body class="gray-bg">
    <div class="container-div">
        <div class="statisticsPanal common-container">
            <div class="hoverContainer" th:each="item:${items}">
                <div class="container" >
                    <div class="titleName" th:text="${item.name}">
                    </div>
                    <div class="content-value" th:text="${item._value}">
                    </div>
                </div>
            </div>
        </div>
        <div class="chartContainer common-container">
            <div id="jobSuccessAndFailed" style="width: 800px;height:400px;"></div>
        </div>

    </div>
    <script src="https://cdn.staticfile.org/echarts/4.3.0/echarts.min.js"></script>
    <script th:src="@{/js/jquery.min.js}"></script>
    <script th:src="@{/js/bootstrap.min.js}"></script>
    <script th:src="@{/ajax/libs/layer/layer.min.js}"></script>
    <script th:inline="javascript">

        var successList = [[${success}]]
        var failedList = [[${failed}]]
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('jobSuccessAndFailed'));
            // 指定图表的配置项和数据
            option = {
            title: {
            text: '今年任务情况概览'
        },
            tooltip: {
            trigger: 'axis'
        },
            legend: {
            data: ['执行成功', '执行失败']
        },
            grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
            toolbox: {
            feature: {
            saveAsImage: {}
        }
        },
            xAxis: {
            type: 'category',
            boundaryGap: false,
            data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月','8月', '9月','10月', '11月', '12月']
        },
            yAxis: {
            type: 'value'
        },
            series: [
        {
            name: '执行成功',
            type: 'line',
            stack: 'Total',
            data: successList
        },
        {
            name: '执行失败',
            type: 'line',
            stack: 'Total',
            data: failedList
        }
            ]
        };
        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);

    </script>
</body>
<style>
    .common-container{
        margin-right: 15px;
        margin-left: 15px;
        background-color: white;
        border-radius: 6px;
        margin-top: 10px;
        padding-top: 5px;
        padding-bottom: 13px;
    }
    .statisticsPanal{
        padding: 10px;
        display: flex;
        flex-direction: row;
    }
    .hoverContainer{
        padding: 10px;
    }
    .container{
        height: 100px;
        width: 180px;
        background:  rgba(200,255,200,0.5);
        /* background-color: #ccffcc; */
        border: 1px solid #999;
        box-shadow: 3px 4px 5px grey;
        border-radius: 4px;
    }

    .titleName{
        font-size: 18px;
        color: #003300;
        font-family: Arial, Helvetica, sans-serif;
        margin-top: 18px;
        text-align: center;
    }

    .content-value{
        margin-top: 10px;
        font-size: 20px;
        color: #c40000;
        text-align: center;
    }
</style>
</html>
